var mongo = require('mongodb');
var host = process.env['MONGO_NODE_DRIVER_HOST'] != null ? 
             process.env['MONGO_NODE_DRIVER_HOST'] : 
             'localhost';
var port = process.env['MONGO_NODE_DRIVER_PORT'] != null ? 
             process.env['MONGO_NODE_DRIVER_PORT'] : 
             mongo.Connection.DEFAULT_PORT;

var controller = {
  instance: null
};

controller._init = function(){
  this.instance = new mongo.Db('some-js', new mongo.Server(host,port,{}));
};

controller.connect = function(){
  this._init();
  this.instance.open(function(err, db){
    if(err)
      console.log(err);
    console.log(db);
  });
}

exports.db = controller;
